package scala.basic

import scala.io.StdIn

/**
 * 分支判断
 *
 */
case object IfElseTest {
  def main(args: Array[String]): Unit = {
    println("input age:")
    var age = StdIn.readShort()
    if (age < 18) {
      println("童年")
    } else if (age <= 30 && age >= 18) {
      println("中年")
    } else {
      println("老年")
    }

    var res: Any = if (age < 18) {
      "童年"
    } else if (age <= 30 && age >= 18) {
      "中年"
    } else {
      100
    }
    println(res)
    var res1: Any = if (age < 18) "童年" else "老年"
    println(res1)
  }
}
